package xyz.yuzegod.megawalls.classes.normal.creeper;

import xyz.yuzegod.megawalls.classes.Classes;
import xyz.yuzegod.megawalls.classes.Skill;
import xyz.yuzegod.megawalls.game.GamePlayer;
import xyz.yuzegod.megawalls.stats.KitStatsContainer;
import xyz.yuzegod.megawalls.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class SecondSkill extends Skill
{
    public SecondSkill(final Classes classes) {
        super("裂变心脏", classes);
    }
    
    @Override
    public int maxedLevel() {
        return 3;
    }
    
    @Override
    public double getAttribute(final int level) {
        switch (level) {
            case 1: {
                return 0.3333;
            }
            case 2: {
                return 0.6667;
            }
            case 3: {
                return 1.0;
            }
            default: {
                return 0.3333;
            }
        }
    }
    
    public double getDamage(final int level) {
        switch (level) {
            case 1: {
                return 0.5;
            }
            case 2: {
                return 0.75;
            }
            case 3: {
                return 1.0;
            }
            default: {
                return 0.5;
            }
        }
    }
    
    @Override
    public List<String> getInfo(final int level) {
        final List<String> lore = new ArrayList<String>();
        if (level == 1) {
            lore.add(" §8▪ §7被击杀时,有§a" + StringUtils.percent(this.getAttribute(level)) + "§7几率");
            lore.add("   §7生成一个爬行者。");
            lore.add("   §7放置一个速爆TNT并且造成§a" + this.getDamage(level));
            lore.add("   §7点伤害但不破坏方块。");
            return lore;
        }
        lore.add(" §8▪ §7被击杀时,有§8" + StringUtils.percent(this.getAttribute(level - 1)) + " ➜ §a" + StringUtils.percent(this.getAttribute(level)) + "§7几率");
        lore.add("   §7生成一个爬行者。");
        lore.add("   §7放置一个速爆TNT并且造成§8" + this.getDamage(level - 1) + " ➜ §a" + this.getDamage(level));
        lore.add("   §7点伤害但不破坏方块。");
        return lore;
    }
    
    @Override
    public void upgrade(final GamePlayer gamePlayer) {
        final KitStatsContainer kitStats = gamePlayer.getPlayerStats().getKitStats(this.getClasses());
        kitStats.addSkill2Level();
    }
    
    @Override
    public int getPlayerLevel(final GamePlayer gamePlayer) {
        return gamePlayer.getPlayerStats().getKitStats(this.getClasses()).getSkill2Level();
    }
    
    @Override
    public boolean use(final GamePlayer gamePlayer, final KitStatsContainer kitStats) {
        return true;
    }
}
